<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>立方体</title>
</head>
<body>
    <div class="container">
        <div class="cube">
            <div class="side front"></div>
            <div class="side left"></div>
            <div class="side right"></div>
            <div class="side back"></div>
            <div class="side top"></div>
            <div class="side bottom"></div>
        </div>
    </div>
    <style>
        body{
            background-color: #eee;
        }

        .con{
            position: relative;
            perspective: 800px;
            perspective-origin: top right;
            width: 400px;
            height: 400px;
            margin: 400px auto;
            border: 2px solid white;
            border-radius: 4px;
        }

        .cube{
            position: absolute;
            width: 200px;
            height: 200px;
            transform-style: preserve-3d;
            margin: auto;
            left: 50%;
            top: 50%;
            transform: translate(-50%,-50%);
            animation: move 10s ease-in-out infinite;
        }

        .side{
            position: absolute;
            width: 100%;
            height: 100%;
            opacity: 0.6;
            border: 2px solid white;
            text-align: center;
            line-height: 200px;
        }

        .front{
            background-color: rgb(235, 160, 214);
            transform: translateZ(100px);
            background: url(./TNT.jpg) no-repeat center/contain;
        }

        .back{
            background-color: rgb(247, 251, 250);
            transform: rotateY(180deg) translateZ(-100px);
        }

        .left{
            background-color: rgb(227, 215, 119);
            transform: translateX(-100px) rotateY(-90deg);
        }

        .right{
            background-color: rgb(145, 227, 227);
            transform: translateX(100px) rotateY(90deg);
        }

        .top{
            background-color: aquamarine;
            transform: translateY(-100px) rotateX(90deg);
        }

        .bottom{
            background-color: green;
            transform: translateY(100px) rotateX(-90deg);
        }

        @keyframes move {
            from {
               transform: translate(-50%, -50%) rotateY(0deg) rotateX(720deg) rotateZ(0deg);
            }

            to {
               transform: translate(-50%, -50%) rotateY(360deg) rotateX(0deg) rotateZ(360deg);
            }
        }
    </style>
</body>
</html>